// Copyright  2012 Petr TALLA. [petr.talla@gmail.com]
// This file is free software; you can redistribute it and/or modify it
// under the terms of the GNU Lesser General Public License
// as published by the Free Software Foundation; either
// version 2 of the License, or (at your option) any later version.
//
// This file is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY;  without even the implied warranty
// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
// See the GNU Lesser General Public License for more details.
// [http://www.gnu.org/copyleft/lesser.html]
//=============================================================================

package tc.crase.meta;

public class LinkEstimate {
	public String objectType1;
	public String linkName1;
	
	public String objectType2;
	public String linkName2;
	
	public LinkEstimate(String objectType1, String linkName1, String objectType2, String linkName2) {
		this.objectType1 = objectType1;
		this.linkName1   = linkName1;

		this.objectType2 = objectType2;
		this.linkName2   = linkName2;
	}
	
	public boolean fits(String objectType1, String objectType2) {
		if ( objectType1.equals(this.objectType1) && objectType2.equals(this.objectType2) ) return true;
		return false;
	}
	
	public String getName(boolean reverse) {
		return getLinkName1(reverse) + "-" + getLinkName2(reverse); 
	}
	
	public String getLinkName1( boolean reverse) {
		if (reverse) {
			return linkName2;
		}
		else {
			return linkName1;
		}
	}
	
	public  String getLinkName2( boolean reverse) {
		if (reverse) {
			return linkName1;
		}
		else {
			return linkName2;
		}
	}
	
}